Class com.symantec.itools.vcafe.openapi.SourceFile
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.symantec.itools.vcafe.openapi.SourceFile

Object
   |
   +----com.symantec.itools.vcafe.openapi.SourceFile

public abstract class SourceFile
extends Object
The API used to represent and access a Visual Cafe source file.

Version:
1.0
Author:
Symantec Internet Tools Division
Since:
VCafe 3.0
See Also:
VisualProject, ProjectFile, Range

Constructor Index

 o com.symantec.itools.vcafe.openapi.SourceFile()

Method Index

 o addSourceFileListener(SourceFileListener)
Add a listener to this SourceFile.
 o close(boolean)
Closes this SourceFile's editor window, and optionally save its contents.
 o edit()
Activates this SourceFile's editor window.
 o equals(SourceFile)
Determine if two SourceFile objects represent the same file.
 o getFile()
Gets the File associated with this SourceFile.
 o getFullName()
Gets the pathname of the File associated with this SourceFile.
 o getInsertionPoint()
Gets the current insertion point, in zero-based bytes.
 o getName()
Gets the base name of the File associated with this SourceFile.
 o getProjectFile()
Gets the ProjectFile associated with this SourceFile.
 o getRangeText(Range)
Gets the text within the specified Range.
 o getRangeTextString(Range)
Gets the text within the specified Range as a String.
 o getSelectionRange()
Gets the Range of the currently selected text.
 o getText()
Gets this SourceFile's entire contents.
 o getTextString()
Gets this SourceFile's entire contents as a String.
 o isLocked()
Determines whether this SourceFile is locked (on disk, or locked in source control).
 o isModified()
Determines whether this SourceFile has been modified.
 o isOpen()
Determines if this SourceFile is open in an editor window.
 o removeSourceFileListener(SourceFileListener)
Remove a listener from this SourceFile.
 o revertToSaved()
Refreshes this SourceFile's editor window with the contents on disk.
 o save()
Saves the contents of this SourceFile to disk.
 o setModified(boolean)
Set the modified flag of this SourceFile.
 o setRangeText(StringBuffer, Range)
Replaces the text in the given Range with the new text.
 o setRangeText(String, Range)
Replaces the text in the given Range with the new text String.
 o setSelectionRange(Range)
Sets the range of the currently selected text.
 o setText(StringBuffer)
Replaces the SourceFile's entire contents.
 o setText(String)
Replaces the SourceFile's entire contents with the contents of a String.
 o toString()
Gets a String that represents this object.

Constructors

 o SourceFile
public SourceFile()

Methods

 o addSourceFileListener
public abstract void addSourceFileListener(SourceFileListener listener)
Add a listener to this SourceFile. All changes to this SourceFile are broadcast to the listeners registered with it.

Parameters:
listener - the object that receives notifications of changes to the SourceFile.
See Also:
SourceFileListener, removeSourceFileListener, addSourceFileListener
 o close
public abstract void close(boolean saveChanges)
Closes this SourceFile's editor window, and optionally save its contents.

Parameters:
saveChanges - true to save this file's contents, false to discard any changes made to this SourceFile.
 o edit
public abstract void edit()
Activates this SourceFile's editor window. If this SourceFile isn't open yet, it is opened.

 o equals
public abstract boolean equals(SourceFile sourceFile)
Determine if two SourceFile objects represent the same file.

 o getFile
public abstract java.io.File getFile()
Gets the File associated with this SourceFile. This method never returns null, but the actual file may not exist on disk (i.e. File.exists() == false).

Returns:
the File associated with this SourceFile.
 o getFullName
public abstract java.lang.String getFullName()
Gets the pathname of the File associated with this SourceFile.

Returns:
the complete filename of this SourceFile.
 o getInsertionPoint
public abstract int getInsertionPoint()
Gets the current insertion point, in zero-based bytes.

Returns:
the current insertion point, in zero-based bytes, or 0 if the SourceFile is not currently open.
 o getName
public abstract java.lang.String getName()
Gets the base name of the File associated with this SourceFile. The base name is everything in the pathname after the last occurrence of the separator character (i.e. no directory information).

Returns:
this file's base filename.
 o getProjectFile
public abstract com.symantec.itools.vcafe.openapi.ProjectFile getProjectFile()
Gets the ProjectFile associated with this SourceFile. If this file is not in a project, returns null.

Returns:
The ProjectFile, or null if this file is not in a project.
See Also:
ProjectFile
 o getRangeText
public abstract java.lang.StringBuffer getRangeText(Range theRange)
Gets the text within the specified Range. The current selection range of this SourceFile is not changed by this method.

Parameters:
theRange - the Range from which to get the text.
Returns:
a StringBuffer containing the in-range text.
 o getRangeTextString
public abstract java.lang.String getRangeTextString(Range theRange)
Gets the text within the specified Range as a String. The current selection range of this SourceFile is not changed by this method.

Parameters:
theRange - the Range from which to get the text.
Returns:
a String containing the in-range text.
 o getSelectionRange
public abstract com.symantec.itools.vcafe.openapi.Range getSelectionRange()
Gets the Range of the currently selected text.

Returns:
the current text selection range, or null if the SourceFile is not currently open.
 o getText
public abstract java.lang.StringBuffer getText()
Gets this SourceFile's entire contents.

Returns:
a StringBuffer containing the entire SourceFile contents.
 o getTextString
public abstract java.lang.String getTextString()
Gets this SourceFile's entire contents as a String.

Returns:
a String containing the entire SourceFile contents.
 o isLocked
public abstract boolean isLocked()
Determines whether this SourceFile is locked (on disk, or locked in source control).

Returns:
true if locked either on disk or in source control, false if it is not locked.
 o isModified
public abstract boolean isModified()
Determines whether this SourceFile has been modified.

Returns:
true if it has been modified, false otherwise.
 o isOpen
public abstract boolean isOpen()
Determines if this SourceFile is open in an editor window.

Returns:
true if the file is open, false otherwise.
 o removeSourceFileListener
public abstract void removeSourceFileListener(SourceFileListener listener)
Remove a listener from this SourceFile. The listener stops receiving notifications of changes to this SourceFile.

Parameters:
listener - the object that was receiving notifications.
See Also:
SourceFileListener, addSourceFileListener, removeSourceFileListener
 o revertToSaved
public abstract void revertToSaved()
Refreshes this SourceFile's editor window with the contents on disk.

 o save
public abstract void save()
Saves the contents of this SourceFile to disk.

 o setModified
public abstract boolean setModified(boolean modified)
Set the modified flag of this SourceFile. Note: Use this method ONLY for marking the SourceFile as modified when the changes haven't been set with setRangeText() or setText(). Note: Use of this method does not result in listeners being notified of the change. This can be useful when making a change that hasn't been committed, so that if the user closes the SourceFile's editor window, the user is prompted to save the changes. You can then flush or commit your changes. You should listen for other changes to the SourceFile, so you don't inadvertantly set the SourceFile as unmodified, when it has been modified elsewhere.

Parameters:
modified - the new modified state of this SourceFile.
Returns:
the previous modified state of the SourceFile.
See Also:
SourceFileListener
 o setRangeText
public abstract void setRangeText(StringBuffer newText,
                                  Range theRange)
Replaces the text in the given Range with the new text. The resulting new Range is then returned in theRange.

Parameters:
newText - the new replacement text.
theRange - on input, the range of text to be replaced. On output, the newly resulting range.
 o setRangeText
public abstract void setRangeText(String newText,
                                  Range theRange)
Replaces the text in the given Range with the new text String. The resulting new Range is then returned in theRange.

Parameters:
newText - the new replacement text.
theRange - on input, the range of text to be replaced. On output, the newly resulting range.
 o setSelectionRange
public abstract void setSelectionRange(Range newRange)
Sets the range of the currently selected text.

Parameters:
the - new text selection range.
 o setText
public abstract void setText(StringBuffer newText)
Replaces the SourceFile's entire contents.

Parameters:
newText - the new contents of this SourceFile.
 o setText
public abstract void setText(String newText)
Replaces the SourceFile's entire contents with the contents of a String.

Parameters:
newText - the new contents of this SourceFile.
 o toString
public java.lang.String toString()
Gets a String that represents this object.

Returns:
the String.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index